import request from '@/utils/request'
import axios from 'axios'
import {
  transformQueryCondition
} from '@/utils'
import qs from 'qs'

//axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'

// 插入
export function insertItem(data) {
  return request({
    url: '/uums/AdminManagement',
    method: 'POST',
    data: data
  })
}

// 批量插入
export function batchInsertItemUser(data) {
  return request({
    url: '/uums/AdminManagement/batch',
    method: 'POST',
    data: data
  })
}

// 复合检索
export function compositeSelect(query) {
  const searchCon = transformQueryCondition(query)
  return request({
    url: '/uums/AdminManagement/adminUserSelected?isExist=' + query.isExist,
    method: 'POST',
    data: searchCon
  })
}

// 求件
export function countSelect(query) {
  const searchCon = transformQueryCondition(query)
  return request({
    url: '/uums/AdminManagement/count',
    method: 'POST',
    data: searchCon
  })
}

// 强制删除
export function forceDeleteItem(data) {
  return request({
    url: '/uums/AdminManagement/force',
    method: 'DELETE',
    data: data
  })
}

// 批量强制删除
export function batchDeleteItem(data) {
  return request({
    url: '/uums/AdminManagement/force/batch',
    method: 'DELETE',
    data: data
  })
}
// 保存
export function compositeScach(data) {
  return request({
    // url: '/uums/SysRole/force/batch',
    url: '/uums/SysCodeInfo/select',
    method: 'POST',
    data: data
  })
}

// 检索
export function select(query) {
  const searchCon = transformQueryCondition(query)
  return request({
    url: '/uums/SysRole/select',
    method: 'POST',
    data: searchCon
  })
}

// 更新
export function updateItem(id, data) {
  return request({
    url: '/uums/SysRole/' + id,
    method: 'PUT',
    data: data
  })
}

// 检索
export function selectSysSubsys(query) {
  const searchCon = transformQueryCondition(query)
  return request({
    url: '/uums/SysSubsystemInfo/select',
    method: 'POST',
    data: searchCon
  })
}

// 检索
export function SelectRoleAndSubSys(query) {
  const searchCon = transformQueryCondition(query)
  return request({
    url: '/uums/SysRoleInfo/SelectRoleAndSubSys',
    method: 'POST',
    data: searchCon
  })
}

//关键字
export function selectKeyWord(data) {
  console.log(data)
  var myData = {
    content: data.content
  }
  //	myData = JSON.stringify(myData);
  //	const myData = qs.stringify(data)
  console.log(myData);
  return axios({
    // url: 'http://172.10.103.129:8081/news/analyzer.do',
    url: 'https://bigdata.ccmapp.cn/sjfw/news/analyzer.do',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    method: 'POST',
    data: myData
  })
}

//敏感词
export function selectSensitive(code1, code2) {
  //	let Qs1 = qs.stringify(code1)
  //	let Qs2 = qs.stringify(code2)
  //内容
  //	Qs1 = Qs1.slice(5)
  //标题
  //	Qs2 = Qs2.slice(5)
  let json = {
    title: code2.code,
    content: code1.code
  }
//   const ThisURL = 'http://172.10.103.140:8088/articleFilter/articleFilterV2';
  const ThisURL = 'https://bigdata.ccmapp.cn/mgc/articleFilter/articleFilterV2';
  return request({
    url: ThisURL,
    method: 'POST',
    data: json
  })
}
//问题反馈列表信息
export function getAppProbleListAll(data) {
  return request({
    url: '/zcm/zcm/appProble/getAppProbleListAll2',
    method: 'POST',
    data: data
  })
}
//版本维护列表信息
export function getProbleList(data) {
  return request({
    url: '/zcm/zcm/file/appUplodHistoryList',
    method: 'POST',
    data: data
  })
}
//版本维护上传
export function uploadAppFile(data) {
  return request({
    url: '/zcm/zcm/file/uploadAppFile/' + data.id + '/' + data.appid + '/' + data.describe,
    method: 'POST',
    data: data
  })
}
// 发布回复
export function replyAppProble(data) {
  return request({
    url: '/zcm/zcm/appProble/replyAppProble',
    method: 'POST',
    data: data
  })
}
// three
export function three(data) {
  return request({
    url: '/uums/SysRole/batch',
    method: 'POST',
    data: data
  })
}
// four
export function four(data) {
  return request({
    url: '/uums/SysRole/batch',
    method: 'POST',
    data: data
  })
}
